using System;

namespace EasyDapr.Infrastructure.Attribute
{
    /// <summary>
    /// An attribute to indicate a class is a component.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class DaprComponentAttribute : System.Attribute
    {
        /// <summary>
        /// The lifetime of the component.
        /// </summary>
        public LifeStyle LifeStyle { get; }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public DaprComponentAttribute() : this(LifeStyle.Singleton) { }
        /// <summary>
        /// Parameterized constructor.
        /// </summary>
        /// <param name="lifeStyle"></param>
        public DaprComponentAttribute(LifeStyle lifeStyle)
        {
            LifeStyle = lifeStyle;
        }
    }
    /// <summary>An enum to description the lifetime of a component.
    /// </summary>
    public enum LifeStyle
    {
        /// <summary>
        /// Represents a component is a transient component.
        /// </summary>
        Transient,
        /// <summary>
        /// Represents a component is a singleton component.
        /// </summary>
        Singleton
    }
}